// Session过期，页面跳转登录页面不能在Frame中打开
if (window.top != window)
	window.top.location = "./";

// 回车提交表单自动登录
function keyPressEvt(event) {
	if (event.keyCode == 13) {
		$("form").submit();
	}
}

// 切换验证码
function switchCaptcha(tag) {
	var src = tag.getAttribute("src");
	var path = src.substring(0, src.lastIndexOf("=") + 1);
	path = path + new Date().getTime();
	tag.setAttribute("src", path);
}

// 回车提交表单
function keyPressEvt(event)
{
    if (event.keyCode == 13)
    {
    	$("form").submit();
    }
}

// 表单验证
function checkSubmit(){
	var div = $("#feedbackDiv");
	
	div.empty();
	
	var account = $("#txtAccount");
	if( account.val() == null || account.val() == ""){
		div.append("<wicket:panel><ul class='feedbackPanel'><li class='feedbackPanelERROR'><span class='feedbackPanelERROR'>帐号是必填项！</span></li></ul></wicket:panel>");
		account.get(0).focus();
		return false;
	}

	var password = $("#txtPassword"); 
	if( password.val() == null || password.val() == ""){
		div.append("<wicket:panel><ul class='feedbackPanel'><li class='feedbackPanelERROR'><span class='feedbackPanelERROR'>密码是必填项！</span></li></ul></wicket:panel>");
		password.get(0).focus();
		return false;
	}

	var captcha = $("#txtCaptcha");
	if( captcha.val() == null || captcha.val() == ""){
		div.append("<wicket:panel><ul class='feedbackPanel'><li class='feedbackPanelERROR'><span class='feedbackPanelERROR'>验证码是必填项！</span></li></ul></wicket:panel>");
		captcha.get(0).focus();
		return false;
	}
	return true;

}